package com.xintonghua.bussiness.adapter;

import android.app.Activity;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.xintonghua.base.adapter.BaseAdapter;
import com.xintonghua.bussiness.R;
import com.xintonghua.bussiness.bean.ClickTypeBean;
import com.xintonghua.bussiness.bean.MemberBirthdayBean;
import com.xintonghua.bussiness.util.GlideUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by liqi on 2018/3/29.
 * 顾客类别适配器
 */

public class MemberTypeAdapter extends BaseAdapter<ClickTypeBean.ThisTypeBean, MemberTypeAdapter.ClientViewHolder> {

    Context context;

    public MemberTypeAdapter(Activity mActivity, List<ClickTypeBean.ThisTypeBean> list) {
        super(mActivity, list);
        this.context = (Context) mActivity;
    }

    @Override
    public MemberTypeAdapter.ClientViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.adapter_client, parent, false);
        return new MemberTypeAdapter.ClientViewHolder(view);
    }

    int memberType = 0;

    @Override
    public void onBindViewHolder(MemberTypeAdapter.ClientViewHolder holder, int position) {

        ClickTypeBean.ThisTypeBean bean = getList().get(position);
        holder.tvName.setText("" + bean.getNickname());
        holder.tvPhone.setText("" + bean.getPhone());
        GlideUtils.loadCricle(context,holder.ivHead,bean.getHead_img());
        holder.tv_all_score.setText("总积分："+bean.getTotalScore());
        holder.tv_selMoney.setText("总余额："+bean.getScore());
    }

    class ClientViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.iv_head)
        ImageView ivHead;
        @BindView(R.id.tv_name)
        TextView tvName;
        @BindView(R.id.tv_phone)
        TextView tvPhone;
        @BindView(R.id.tv_score)
        TextView tvScore;
        @BindView(R.id.tv_gx)
        TextView tvGx;
        @BindView(R.id.tv_all_score)
        TextView tv_all_score;
        @BindView(R.id.tv_selMoney)
        TextView tv_selMoney;

        public ClientViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
